package game;

import java.awt.Color;

public class Player extends AbstractMovingSprite {
	
	private int life = 0;
	
	public Player(int x, int y, int width, int height, Color color) {
		super(x, y, width, height, color);
	}
	
	private Direction horizontalShootingDirection = Direction.NONE;
	
	private Direction verticalShootingDirection = Direction.NONE;
	
	public Direction getVerticalShootingDirection() {
		if (verticalDirection != Direction.NONE || horizontalDirection != Direction.NONE) {
			return verticalDirection;
		}
		else {
			return verticalShootingDirection;
		}
	}
	
	public Direction getHorizontalShootingDirection() {
		if (verticalDirection != Direction.NONE || horizontalDirection != Direction.NONE) {
			return horizontalDirection;
		}
		else {
			return horizontalShootingDirection;
		}		
	}
	
	@Override
	public void setVerticalDirection(Direction verticalDirection) {
		if (verticalDirection != Direction.NONE) {
			verticalShootingDirection = verticalDirection;
			horizontalShootingDirection = Direction.NONE;
		}
		super.setVerticalDirection(verticalDirection);
	}
	
	@Override
	public void setHorizontalDirection(Direction horizontalDirection) {
		if (horizontalDirection != Direction.NONE) {
			horizontalShootingDirection = horizontalDirection;
			verticalShootingDirection = Direction.NONE;
		}
		super.setHorizontalDirection(horizontalDirection);
	}

	public int getLife() {		
		return life;
	}
	
	public void setLife(int life){
		this.life = life;	
	}
}
